<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>课工场论坛列表</title>
    <link href="css/bbs.css" rel="stylesheet">

    <script>
        function fatie() {
            document.getElementsByClassName("post")[0].style.display="block";
        }

        function fabu() {
            var title=document.getElementsByClassName("title")[0].value;
            var select=document.getElementsByTagName("select")[0].value;
            var content=document.getElementsByClassName("content")[0].value;
            var index=Math.floor((Math.random()*3)+1);
            var img=document.createElement("img");
            img.setAttribute("src","images/tou01.jpg");
            var div=document.createElement("div");
            div.appendChild(img);
            var h1=document.createElement("h1");
            h1.innerText=title;
            var span1=document.createElement("span");
            span1.innerText="版块："+select;
            var span2=document.createElement("span");
            var date=new Date();
            span2.innerText="发表时间："+date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate()+"-"+date.getHours()+":"+date.getMinutes();
            var p=document.createElement("p");
            p.appendChild(span1);
            p.appendChild(span2);
            var li=document.createElement("li");
            li.appendChild(div);
            li.appendChild(h1);
            li.appendChild(p);
            document.getElementsByTagName("ul")[0].appendChild(li);
            document.getElementsByClassName("post")[0].style.display="none";

        }

    </script>
</head>
<body>
<div class="bbs">
    <header><span onclick="fatie()">我要发帖</span></header>
    <section>
        <ul>

        </ul>
    </section>
    <div class="post">
        <input class="title" placeholder="请输入标题（1-50个字符）">
        所属版块：<select><option>请选择版块</option><option>电子书籍</option><option>新课来了</option><option>新手报到</option><option>职业规划</option></select>
        <textarea class="content"></textarea>
        <input class="btn" value="发布" onclick="fabu()">
    </div>
</div>
</body>
</html>